<template>
  <a-modal
    :title="title"
    :width="700"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">

    <a-spin :spinning="confirmLoading">
      <a-form-model ref="form">
        <a-row :gutter="24">
          <a-col :span="20">
            <a-form-model-item  prop="jCheckbox">
              <j-checkbox
                v-model="formData.jCheckbox"
                :options="jCheckboxOptions"
              />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form-model>
    </a-spin>
  </a-modal>
</template>

<script>
import { httpAction, postActionparams2 } from '@/api/manage'
  import moment from 'moment'
  import JDate from '@/components/jeecg/JDate'
  import JCheckbox from '@/components/jeecg/JCheckbox'
  export default {
    components: {
      JCheckbox,
      JDate
    },
    name: 'JeecgOrderTicketModal',
    data() {
      return {
        title: '操作',
        visible: false,
        record: {},
        model: {},
        labelCol: {
          xs: {span: 24},
          sm: {span: 5}
        },
        wrapperCol: {
          xs: {span: 24},
          sm: {span: 16}
        },
        formData: {
          jCheckbox: '',
        },
        jCheckbox: '',
        jCheckboxOptions: [
          {label: '无适应症', value: '1'},
          {label: '品种选择不合理（中枢感染宜选美罗培南和帕尼培南）-Boot', value: '2'},
          {label: '品种选择不合理（CRE和重症感染宜选亚胺培南和美罗培南）', value: '3'},
          {label: '品种选择不合理（铜绿、鲍曼感染不应选厄他培南）', value: '4'},
          {label: '品种选择不合理（妊娠患者不推荐亚胺培南和帕尼培南）', value: '5'},
          {label: '品种选择不合理（儿童不推荐比阿培南））', value: '6'},
          {label: '用法错误', value: '7'},
          {label: '用量错误', value: '8'},{label: '肾功不全，给药方案应根据肾功能调整', value: '9'},
          {label: '宜单瓶输注', value: '10'},
          {label: '厄他培南不得用葡萄糖做溶媒', value: '11'},
        ],
      moment,
        format: 'YYYY-MM-DD HH:mm:ss',
        disableSubmit: false,
        orderId: '',
        hiding: false,
        confirmLoading: false,
        url: {
          add: '/test/order/addTicket',
          edit: '/test/order/editTicket'
        }
      }
    },
    created() {
    },
    methods: {
      add(orderId) {
        if (orderId) {
          this.edit({orderId}, '')
        } else {
          this.$message.warning('请选择一条航班数据')
        }
      },
      detail(record) {
        this.edit(record, 'd')
      },
      edit(record, v) {
        if (v == 'e') {
          this.hiding = false;
          this.disableSubmit = false;
        } else if (v == 'd') {
          this.hiding = false;
          this.disableSubmit = true;
        } else {
          this.hiding = true;
          this.disableSubmit = false;
        }
        this.model = Object.assign({}, record);
        this.visible = true;
      },
      close() {
        this.$emit('close');
        this.visible = false;
        this.$refs.form.resetFields();
      },

      handleOk() {
        const that = this;
        var param = {
          box : this.jCheckbox,
          id: this.model.id,
          result: '2',
        }
        postActionparams2('/cro/update', param)
          .then((res) => {
            console.log(res)
            if (res.code == 0) {
              //that.Detail = res.result

            }
          }).finally(() => {
          that.confirmLoading = false;
          that.close();
        })
      },
      pass() {
        console.log("pass?")
        const that = this;
        // 触发表单验证
        var param = {
          id: this.model.id,
          result: '1',
        }
        postActionparams2('/cro/update', param)
          .then((res) => {
            console.log(res)
            if (res.code == 0) {
              //that.Detail = res.result

            }
          })
      },
      handleCancel() {
        this.close()
      }
    }
  }
</script>

<style scoped>

</style>